Skip to content

test(golden): fix the netem loss_seen flake; a failed capture keeps its records - #355

Open
randomizedcoder wants to merge 3 commits into
mainfrom
feat/ernic-verification-4a
Open

randomizedcoder wants to merge 3 commits into
mainfrom
feat/ernic-verification-4a

Conversation

@randomizedcoder

Copy link
Copy Markdown
Owner
  • Root cause of the 1-in-20 loss_seen flake: ethtool tso/gso off doesn't stop TCP building GSO skbs (sk_setup_caps always adds NETIF_F_GSO, net/core/sock.c:2680), and netem drops a GSO skb whole as one loss draw (sch_netem.c:490). A flow with big skbs drew loss rarely and sometimes never.
  • Fix: gso_max_segs 1 on the bulk veths (tcp_tso_segs clamps to it, tcp_output.c:2350), so netem draws per segment. It also closes the round 3 baseline gap (netem vs OutSegs+RetransSegs: ~120 → ~12).
  • A failed capture keeps its records: the guest dumps before failing and the runner decodes into <transcript>.failed/, never the fixture dir. A shell-trap error still exits fast with no dump.
  • Per-flow netem evidence: tcpdump on golden-bulk-a's veth0; new rows bulk_tap_complete and netem_per_flow; pcap and netem-diag.txt go out with the records on a loss_seen failure.
  • Also found by the hunt: ECN fallback off in the root netns too (the ernic dctcp client fell back to dctcp-reno once); seq_retrans subtracts DSACKed spurious retransmits.
  • Hunt with the fix: 20/20 captures pass all 55 rows, every flow 60–128 netem drops each way (before: as few as 8); xtcp2-golden diff clean in 19, the 20th the known IPv6 listener-drop flake (TODO in the doc).
  • Checks pass except deadnix and go-sec, which fail on main too.

🤖 Generated with Claude Code

randomizedcoder and others added 3 commits November 27, 2026 01:18
The guest stopped at the first failing row, before the dump, so a
loss_seen failure left nothing to read. Now a row failure still dumps
(GOLDEN_DUMPING, the block, then GOLDEN_ERR with the failing rows, also
in a FAILED file), and the host runner extracts it to
<transcript>.failed/ with scrub and normalize, never to the output
directory. A trap error exits as before, with no dump.

A headers-only tcpdump on golden-bulk-a's veth0 runs through the bulk
transfers. It sees what left netem, so per client port netem's drops are
segs_out minus the segments tapped (GSO skbs counted as ceil(len/mss)),
each way; loss_seen prints them, and bulk_tap_complete checks the tap
lost nothing. On a loss_seen failure the dump also carries
netem-diag.txt (tc, ip -s link, ethtool -k, ss, nstat for both ends)
and the tap's packets for the flows with no retransmits.

Checked by hand: a forced row failure exits 2 and keeps records.parquet
and FAILED in the .failed dir with the output directory untouched; a
forced trap error exits 2 with no .failed dir.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ot netns

- TCP builds GSO skbs even with tso/gso off on the veth (sk_setup_caps
  always adds NETIF_F_GSO, net/core/sock.c:2680). netem drops a GSO skb
  whole and counts it once (sch_netem.c:490), so a flow with big skbs
  drew loss rarely: the loss_seen flake. gso_max_segs 1 on the bulk
  veths makes each skb one segment (tcp_output.c:2350).
- The ernic dctcp client runs in the root netns: set tcp_ecn_fallback=0
  there too.
- seq_retrans subtracts DSACKed spurious retransmits.
- New row netem_per_flow: netem dropped from every bulk flow both ways.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant